<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title></title>
<base href="<?php echo base_url();?>" />
<link href="<?php echo base_url();?>template/admin/default/css/public.css" rel="stylesheet" type="text/css" />
<link href="<?php echo base_url();?>template/admin/default/css/head.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo base_url();?>template/admin/default/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>template/admin/default/js/psufool.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>template/admin/default/js/lhgdialog/lhgdialog.min.js?s=default,chrome,facebook"></script>
<script type="text/javascript">
isTop();
$(function(){
	$(document).bind('contextmenu',function(){return false;}).bind('selectstart',function(){return false;});
})
</script>
</head>

<body>
<div class="main">
<div class="logo"></div>
<div class="side">
<div class="info">
	您好<span class="admin-name"><?php echo $adminUserName;?></span>，欢迎登陆<?php echo $systemTitle?>
	<span class="side-control"><img src="template/admin/default/images/side-con.jpg"
	align="middle" /></span>
	<span class="menu">
		<a href="#" title="清除缓存">清除缓存</a>
		<span class="split">|</span><a href="#" title="网站首页">网站首页</a>
		<span class="split">|</span><a href="#" title="管理首页">管理首页</a>
		<span class="split">|</span><a href="#" title="刷新">刷新</a>
	</span>
</div>
<ul class="nav">
	<li class="left"></li>
	<?php
	$menuI = 0;
	foreach ($menuList as $item):
		$menuI ++;
		if($item->sub_num==0) continue;	
		if(substr($item->url,strlen($item->url)-1,1)!='/'){
			$url = $item->url.'/index/'.$item->id;
		}else{
			$url = $item->url.'index/'.$item->id;
		}		
	?>
	<li class="item"><?php echo anchor($url,$item->title,'title="'.$item->title.'" target="side"')?></li>
	<?php 
	if($menuI!=count($menuList)){
	?>
	<li class="split">|</li>
	<?php
	}
	endforeach;
	?>
</ul>
</div>
</div>
</body>
</html>
<script type="text/javascript">
$(function(){	
	$('.info a').bind('click',menuClick);
	$('.nav .item').bind('click',navClick).eq(0).click();<?php 
	if(isset($checkAdminIsLogin)){
		if($checkAdminIsLogin){
	?>var chkLogin = setInterval(function(){
		var idValue = 0;
		idValue = $.trim($.ajax({async:false,url:'<?php echo site_url('admin/index/writeIsLogin')?>'}).responseText);
		if(idValue.length==0){
			clearInterval(chkLogin);
			loadLogin();
			return false;
		}			
	},1000);<?php
		}
	}
	?>
});

var menuClick = function(){
	var self = $(this);
	var index = self.parent().find('a').index(this);
	switch(index){
		case 0:
			$.ajax({
				type:'get',
				url:'<?php echo site_url('admin/getInfo/index/delcache');?>',
				data:'',
				success:function(msg){
					if(parseInt(msg)==1){
						subMess(188,108,'清除缓存','<span>恭喜您，缓存清除成功！</span>',self);
					}else{
						subMess(188,108,'清除缓存','<span class="red">对不起，缓存清除失败！</span>',self);
					}
				}
			});
			break;
		case 1:
			gotoLocation('<?php echo site_url('../');?>','_blank');
			break;
		case 2:
			window.top.location.reload();
			break;
		default:
			//gotoLocation('<?php echo site_url('admin/logout');?>','_top');
			window.top.main.location.reload();
			break;
	}
	return false;
}

var navClick = function(){
	var self = $(this);
	self.addClass('cur').siblings().removeClass('cur');
}

var loadLogin = function(){
	var strTitle = '登陆超时';
	var strHtml = '<p class="mess-detail"><span class="red">对不起，登陆超时，请重新登陆！</span></p>';
	var loginHeight = 110;
	
	var login = new $.dialog({
		id:'login',
		width:260,
		height:loginHeight,
		iconTitle:false,
		maxBtn:false,
		minBtn:false,
		xButton:false,
		cover:true,
		drag:true,
		rang:true,
		resize:false,
		cancelBtn:true,
		lockScroll:true,
		autoPos:{left:'center',top:'center'},
		cancelBtnTxt:'登陆',
		onCancel:function(){
			gotoLocation('<?php echo site_url('admin/login');?>','_top');
		},		
		title:strTitle,
		html:strHtml
	});	
	login.ShowDialog();
	login.SetIndex(9999);
}

/**
 * 对话框
 * @param dialogWidth		对话框宽度
 * @param dialogHeight		对话框高度
 * @param dialogTitle		对话框标题
 * @param dialogContent		对话框内容
 * @param focuseObj			单击确定后获取焦点对象
 */
var subMess = function(dialogWidth,dialogHeight,dialogTitle,dialogContent,focuseObj){
	var subMessDialog = new $.dialog({		
			id:'subMess',
			width:dialogWidth,
			height:dialogHeight,
			cover: true,
			iconTitle:false,
			xButton:false,
			resize:false,
			rang:true,
			maxBtn:false,
			autoPos:{left:'center',top:'center'},
			cancelBtnTxt:'确定',
			onCancel:function(){
				focuseObj.focus();
			},
			title:dialogTitle,
			html:'<p class="mess-detail">' + dialogContent + '</p>'
	});
	subMessDialog.ShowDialog();
}
</script>
